<template>
    <div class="list">
        <ul>
            <li v-for="(item,index) in arr" :key="index" @click="fun()">
                    <img :src="item.img" alt="" @click="funb()">
                <p>{{item.title}} </p>
            </li>
        </ul>
    </div>
</template>

<script>
import {one} from "@/api/topapi.js"
export default {
    data(){
        return{
           arr:[] 
        }
    },
    mounted(){
        one().then((ok)=>{
            this.arr=ok.data.list2
        })
    },
    methods:{
        fun(){
            this.$router.push("/details")
        },
        funb(){
            this.$store.dispatch("ajaxdemo")
        }
    }
}
</script>

<style lang="scss" scoped>
.list{
    margin-top: 0.2rem;
    overflow: hidden;
}
    ul{
        width: 100%;
        display: flex;
        justify-content: space-around;
        flex-wrap: wrap;
        li{
            list-style: none;
            font-size: 0.12px;
            text-align: center;
            img{
                width: 0.72rem;
                height: 0.5rem;
                border-radius: 50%;
            }
        }
    }
</style>